﻿Imports System.Data

Public Class popup_Items

    Private Sub dg_Outlet_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg_Items.MouseUp
        dg_Items.Select(dg_Items.CurrentRowIndex)
    End Sub
    Private Sub btn_Ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Ok.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK
    End Sub
    Private Sub txt_Filter_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt_Filter.TextChanged
        Dim strName As String
        strName = txt_Filter.Text

        Dim drs As DataRow() = PublicVariables.dt_Item.Select("ItemName like '%" & strName & "%'")
        If drs.Length > 0 Then
            dg_Items.DataSource = drs.CopyToDataTable()
        Else
            'dg_Outlet.
        End If
    End Sub

    Private Sub popup_Items_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'createData()

        dg_Items.DataSource = PublicVariables.dt_Item

    End Sub

    Private Sub createData2()

    End Sub

    Private Sub createData()
        'dt = New DataTable
        'dt.Columns.Add("itemCode")
        'dt.Columns.Add("itemName")
        'dt.Columns.Add("price")
        'Dim dr As DataRow
        'dr = dt.NewRow
        'dr("itemCode") = "I0001"
        'dr("itemName") = "IBM Thinkpad"
        'dr("price") = 500
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("itemCode") = "I0002"
        'dr("itemName") = "Dell inspiron"
        'dr("price") = 700
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("itemCode") = "I0003"
        'dr("itemName") = "HP Compaq"
        'dr("price") = 600
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("itemCode") = "I0004"
        'dr("itemName") = "Sony vaio"
        'dr("price") = 800
        'dt.Rows.Add(dr)

        'dr = dt.NewRow
        'dr("itemCode") = "I0005"
        'dr("itemName") = "Macbook air"
        'dr("price") = 300
        'dt.Rows.Add(dr)
    End Sub

    Private Sub btn_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Cancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub
End Class